package com.nandi.emergencyinspection.mvp

import com.nandi.emergencyinspection.api.ApiServices
import com.tbright.ktbaselibrary.extension.response
import kotlinx.coroutines.launch

/**
 * @创建者: qingsong
 * @创建时间: 2021/3/25 13:28
 * @描述:
 */
class MainPresenter : MainContract.MainPresenter() {

    override fun getList(token: String, page: Int, size: Int, status: Int?, taskName: String?) {
        mainScope.launch {
            mView?.showLoading()
            val singlePoetry = ApiServices.instance.getTaskListAsync(
                "bearer${token}",
                page,
                size,
                state = status,
                taskName = taskName
            ).response()

            mView?.showResult(singlePoetry)

            mView?.hideLoading()
        }
    }
}